package com.njzxw.fs.commonutil.repository;

import com.njzxw.fs.commonutil.bean.LogBean;
import com.njzxw.fs.commonutil.db.ZxwLangDriver;
import org.apache.ibatis.annotations.*;
import org.springframework.beans.factory.annotation.Value;

import java.util.Map;

@Mapper
public interface UserRep {

    /**
     *
     * 获取前台客户用户信息
     *
     * @param clientUserSql
     * @return
     */
    @Select("${clientUserSql}")
    Map<String,Object> getClientUser(@Param("clientUserSql") String clientUserSql);

    /**
     *
     * 获取前台客户用户信息
     *
     * @param backgroundUserSql
     * @return
     */
    @Select("${backgroundUserSql}")
    Map<String,Object> getBackgroundUser(@Param("backgroundUserSql") String backgroundUserSql);

    /**
     * 插入日志
     * @return
     */
    @Update("insert into t_log_info (#{logBean})")
    @Lang(ZxwLangDriver.class)
    Integer insertLog(LogBean logBean);

    @Select("select CONCAT(b.menu_name,'[',a.`name`,']') remark,c.oper_id open_id,c.`name` open_name from " +
            "t_manager_menu_authority a,t_manager_menu b,t_manager_user c \n" +
            "where a.menu_id = b.id \n" +
            "and c.id = #{oper_id}\n" +
            "and LOCATE(a.url,#{oper_url}) > 0 LIMIT 0,1 ")
    Map<String,Object> getLogRemark(LogBean logBean);
}
